package com.feng.financial.manager.rpc;

import com.feng.financial.api.service.ProductRpcService;
import com.feng.financial.api.to.QueryAllProductByPageReq;
import com.feng.financial.common.web.Range;
import com.feng.financial.entity.ProductEntity;
import com.feng.financial.manager.service.ProductService;
import com.googlecode.jsonrpc4j.spring.AutoJsonRpcServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Administrator
 */
@AutoJsonRpcServiceImpl
@Service
public class ProductRpcServiceImpl implements ProductRpcService {

    @Autowired
    private ProductService productService;

    @Override
    public List<ProductEntity> queryAllProductByPage(QueryAllProductByPageReq queryAllProductByPageReq) {
        return productService.findAllByPage(new Range(queryAllProductByPageReq.getStart(),queryAllProductByPageReq.getLength())).getData();
    }

    @Override
    public ProductEntity findOneProduct(String id) {
        return productService.findOne(id);
    }
}
